from pymysql import connect

class Mysql_Help():
    def __init__(self):
        self.user='root'
        self.password=''
        self.host=''
        self.database=''
        self.port=3306

    def get_conn(self):
        conn = connect(user=self.user, password=self.password, host=self.host, database=self.database, port=self.port)
        return conn

    def get_cursor(self):
        cursor=self.get_conn().cursor()
        return cursor

    def selete(self,sql):
        cursor=self.get_cursor()
        cursor.execute(sql)
        result=cursor.fetchall()
        return result

    def dml(self,sql):
        cursor = self.get_cursor()
        cursor.execute(sql)

    def close(self):
        self.get_cursor().close()
        self.get_conn().close()

mysql=Mysql_Help()
mysql.password='123456'
mysql.host='192.168.233.129'
mysql.database='eshop'
sql="select id,title from es_floor"
data=mysql.selete(sql)
print(data)